package lhdx6;

public class Zxf1 {
    public static void main(String[] args) {
        int[]a={2,2,2,2,4,4,4,4};
        int j=0;
        int c=a[j];
        int b=0;
        for (int i=0;i<a.length;i++){
            if (a[i]%2==0&&a[i]!=a[j]){
                b=a[j];
                a[j]=a[i];
                a[i]=b;
                j=i;
            }
        }
        for (int i=a.length-1;i>=0;i--){
            if (a[i]%2!=0&&a[i]!=a[j]){
                b=a[j];
                a[j]=a[i];
                a[i]=b;
                j=i;
            }
        }
        for (int i=0;i<a.length;i++){
            System.out.println(a[i]);
        }
    }
}
